 var id = getvl("id");
 
   $(function(){
   	   if(id!=''){
   	   	  dingdandaifukaun(id);
   	   }else{
   	   //	alert(".....失败");
   	   }
   });
function dingdandaifukaun(){	
	$("#shijian").val("");
     $.ajax({
			url: urlcore + "/api/order/selectOne2?id="+id,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success:function(data){
				if(data.success == true) {
					//时间
	/*	var gmtDatetime = new Date().pattern("yyyy-MM-dd hh:mm:ss");*/
	
	var shijian=data.data.gmtDatetime.replace("-","/");
	var shijian2=shijian.replace("-","/");
				$("#shijian").val(shijian2);	
			var dizhis=data.data.address.province+data.data.address.city+data.data.address.county+data.data.address.address;
			var dizhi=' <ul class="clearfix" style="width: 100%;"> '+
'<li><span>收&nbsp;&nbsp;货&nbsp;&nbsp;人</span>'+data.data.address.userName+'</li>'+
'        <li class="a_xiugai_right">'+
'            <span>电&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;话</span>'+data.data.address.userPhone+''+
'        </li>'+
'        <li><span>收货地址</span>'+dizhis+'</li>'+
'    </ul>';	
			   $("#dizhi").append(dizhi);//地址		
	   $("#shopnaem").html(data.data.shop.storeName);
	   var	leirong="";
			 $.each(data.data.goodsCarList,function(m,q){
			 leirong+='<div class="clearfix tuwen">'+
'    	<a href="../7.0.0goods_detail.html?id='+q.goods.id+'">'+
'	        <div class="tuwen-img fl">'+
'	            <img onerror="errorImg2(this)" src="'+q.goods.coverUrl+'" width="75" height="75">'+
'	        </div>'+
'	        <div class="tuwen-wenzi">'+
'	            <h5 class="wuye_h01">'+q.goods.goodsTitle+'</h5>'+
'	            <div class="wuye_div01">产品质量均有保障</div>'+
'	        </div>'+
'        </a>'+
'    </div>'+
'<div class="dingdan_fenlei clearfix">';



			 $.each(q.myStockList,function(y,n){
			leirong += ' <div class="dingdan_fenlei clearfix">' +
 								'    	<ul class="fl">' +
 								'    		<li>颜色：<span>'+n.colour.colourName+'</span></li>'+
'    		<li>尺码：<span>'+n.size.sizeName+'</span></li>'+
'    		<li>单价：<span>'+q.packRate+'元/件</span></li>'+'    	</ul>' +
 								'    	<div class="fr">' +
 								'    		<h5>' + ((q.packRate*n.saleNum).toFixed(2))+ '元</h5>' +
 								'    		<h6>' + n.saleNum + '件</h6>' +
 								'    	</div>' +
 								'    </div>';
			 });
			 });
			 
			 
			 
			  if(data.data.remark!=null&& data.data.remark!='' && data.data.remark!="null"){
			  	 $("#liuyan").html(data.data.remark);
			  }
			
			  $("#shangshuliang").html(data.data.goodsNumber);
			   $("#heji").html("&yen;"+data.data.orderMoney);
			    var peisong="";
			    if(data.data.giveType==1){
			    	peisong="包邮";
			    }else if(data.data.giveType==2){
			    	peisong="快递";
			    }else if(data.data.giveType==3){
			    	peisong="物流到付";
			    }
			   $("#peisong").html(peisong);
			   
		var feiyongmingxi='<li>商品总金额<span>&yen;'+data.data.orderMoney+'</span></li>'+
'        <li>总运费<span>+&yen;'+data.data.freightMoney+'</span></li>'+
'        <li>优惠券<span>-&yen;'+data.data.saveMoney+'</span></li>'+
'        <li>金币抵扣<span>-&yen;'+data.data.goldMoney+'</span></li>';
    var fangshi="未支付";
           if(data.data.payType==1){
           	  fangshi="余额支付";
           }else if(data.data.payType==2){
           	 fangshi="支付宝支付";
           }else if(data.data.payType==3){
           	fangshi="微信支付";
           }else if(data.data.payType==4){
           	fangshi="银联支付";
           }
      /*var gmtDatetime = new Date().pattern("yyyy-MM-dd hh:mm:ss");*/
 var dingdanxingxi='<li>订单编号<span>'+data.data.orderNumber+'</span></li>'+
 '        <li>付款方式<span>'+fangshi+'</span></li>'+
'        <li>创建时间<span>'+data.data.gmtDatetime+'</span></li>';
   $("#shifujine").html("&yen;"+data.data.payMoney);    
	$("#feiyongmingxi").append(feiyongmingxi);//费用信息
    $("#dingdanxingxi").append(dingdanxingxi);//费用信息
	$("#neirong").append(leirong);

       var fukauns='<span class="dingdan_quxiao" onclick="bianhaos('+data.data.orderNumber+')">取消订单</span>'+
			'<a href="../12.0.0zhifu_goods.html?orid='+data.data.id+'" id="zhifus">去支付</a>';
	$("#fukuans").append(fukauns); 
	
	$(function(){
		  $(".dingdan_quxiao").on('click',function(){
        $("body").append("<div id='mask'></div>");
        $(".show-quxiao").show();
    })
    //点击关闭
    $(".Quxiao").on('click',function(){
        $(".show-quxiao").hide();
        $("#mask").remove();
    }) 
	})
	
	
	
			 }
			},
			error:function() {
				alert("error");
			}
		});
}



function bianhaos(te){
	$("#biaohaos").val("");
	$("#biaohaos").val(te);
}

function  querenquxiao(){
	
	 var biaohaos=$("#biaohaos").val();  
	 if(biaohaos==''){
	 	alert("出现异常");
	 }else{
   	  $.ajax({
      url: urlcore+"/api/order/cancelOrder?orderNumber="+biaohaos,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					  window.location.reload();				 
				  	 
				}
		/*console.log(goodslist);*/
			},
			error: function() {
				alert("error");
			}
		});
}
	 
	 
}
